// 节流：立即执行版本
export function throttle<P, T extends (...args: any) => void>(fn: T, delay: number): (...args: Parameters<T>) => void {
  let lastCall = 0

  return (...args: any) => {
    const now = Date.now()
    const elapsed = now - lastCall

    if (elapsed >= delay) {
      fn(...args)
      lastCall = now
    }
  }
}
